package com.netease.pris.activity;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.text.Editable;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.animation.Animation;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.TextView;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.a.a;
import com.netease.pris.a.h;
import com.netease.pris.activity.a.ak;
import com.netease.pris.activity.view.ListViewEx;
import com.netease.pris.app.PrisApp;
import com.netease.pris.atom.g;
import com.netease.pris.atom.u;
import com.netease.pris.b;
import java.util.LinkedList;

public class SubsInfoActivity extends ActivityEx
{
  public static final int a = 2;
  public static final int b = 0;
  public static final int c = 1;
  private static final String g = "comment";
  private TextView A = null;
  private TextView B = null;
  private TextView C = null;
  private EditText D = null;
  private RatingBar E = null;
  private RatingBar F = null;
  private ImageView G = null;
  private Button H = null;
  private Button I = null;
  private Button J = null;
  private Button K = null;
  private Button L = null;
  private InputMethodManager M = null;
  private CheckBox N = null;
  private LinearLayout O = null;
  private LinearLayout P = null;
  private LinearLayout Q;
  private LinearLayout R;
  private ListViewEx S;
  private ListViewEx T;
  private TextView U;
  private TextView V;
  private TextView W;
  private AdapterView.OnItemClickListener X = new dp(this);
  View.OnClickListener d = new dr(this);
  View.OnTouchListener e = new dq(this);
  b f = new dt(this);
  private boolean h = false;
  private boolean i = false;
  private boolean j = false;
  private boolean k = false;
  private boolean l = false;
  private int m = 0;
  private int n = 0;
  private int o;
  private String p = null;
  private u q = null;
  private LinkedList r = null;
  private LinkedList s = null;
  private LinkedList t;
  private com.netease.pris.activity.a.v u;
  private ak v;
  private Context w = null;
  private ImageView x = null;
  private TextView y = null;
  private ProgressBar z;

  private void a(int paramInt, Object paramObject, String paramString1, String paramString2)
  {
    switch (paramInt)
    {
    default:
      return;
    case 302:
      this.m = com.netease.pris.v.a().a((u)paramObject);
    case 303:
    case 304:
    case 800:
    case 804:
    case 801:
    }
    while (true)
    {
      this.t.add(new Integer(this.m));
      break;
      this.m = com.netease.pris.v.a().b((u)paramObject);
      continue;
      this.m = com.netease.pris.v.a().a(paramString1);
      continue;
      this.m = com.netease.pris.v.a().a(paramString1, paramString2);
      continue;
      this.m = com.netease.pris.v.a().b(paramString1, paramString2);
      continue;
      this.m = com.netease.pris.v.a().a((String)paramObject, paramString1, paramString2);
    }
  }

  public static void a(Context paramContext, u paramu)
  {
    a(paramContext, paramu, false);
  }

  public static void a(Context paramContext, u paramu, boolean paramBoolean)
  {
    PrisApp.a().a(paramu);
    Intent localIntent = new Intent(paramContext, SubsInfoActivity.class);
    localIntent.putExtra("comment", paramBoolean);
    paramContext.startActivity(localIntent);
  }

  private void a(com.netease.pris.protocol.d paramd)
  {
    try
    {
      if (paramd.h.size() > 0)
        this.R.setVisibility(0);
      while (true)
      {
        this.v.a();
        this.v.a(paramd.h);
        break;
        this.R.setVisibility(8);
      }
    }
    catch (NullPointerException localNullPointerException)
    {
      localNullPointerException.printStackTrace();
    }
    finally
    {
    }
  }

  private void a(com.netease.pris.protocol.d paramd, boolean paramBoolean)
  {
    try
    {
      if (paramd.h.size() > 0)
        this.Q.setVisibility(0);
      if (paramBoolean)
        this.u.b(paramd.h);
      while (true)
      {
        b();
        break;
        this.u.a();
        this.u.a(paramd.h);
      }
    }
    catch (NullPointerException localNullPointerException)
    {
      localNullPointerException.printStackTrace();
    }
    finally
    {
    }
  }

  private void c()
  {
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    localBuilder.setIcon(2130837639);
    localBuilder.setTitle(2131361976);
    localBuilder.setMessage(2131361977);
    localBuilder.setPositiveButton(2131361978, new dn(this));
    localBuilder.setNegativeButton(17039360, new do(this));
    localBuilder.show();
  }

  private void e()
  {
    this.G = ((ImageView)findViewById(2131558408));
    this.x = ((ImageView)findViewById(2131558625));
    this.y = ((TextView)findViewById(2131558628));
    this.z = ((ProgressBar)findViewById(2131558412));
    this.A = ((TextView)findViewById(2131558631));
    this.B = ((TextView)findViewById(2131558632));
    this.C = ((TextView)findViewById(2131558603));
    this.E = ((RatingBar)findViewById(2131558630));
    this.H = ((Button)findViewById(2131558633));
    this.I = ((Button)findViewById(2131558634));
    this.O = ((LinearLayout)findViewById(2131558611));
    this.F = ((RatingBar)findViewById(2131558612));
    this.D = ((EditText)findViewById(2131558613));
    this.K = ((Button)findViewById(2131558614));
    this.L = ((Button)findViewById(2131558615));
    this.N = ((CheckBox)findViewById(2131558601));
    this.P = ((LinearLayout)findViewById(2131558600));
    this.Q = ((LinearLayout)findViewById(2131558604));
    this.R = ((LinearLayout)findViewById(2131558608));
    this.S = ((ListViewEx)findViewById(2131558606));
    this.T = ((ListViewEx)findViewById(2131558610));
    this.J = ((Button)findViewById(2131558607));
    this.U = ((TextView)findViewById(2131558602));
    this.V = ((TextView)findViewById(2131558605));
    this.W = ((TextView)findViewById(2131558609));
    int i1 = k.a(this).c(2131230934);
    if (k.a(this).c())
    {
      this.U.setShadowLayer(0.5F, 0.0F, 2.0F, i1);
      this.V.setShadowLayer(0.5F, 0.0F, 2.0F, i1);
      this.W.setShadowLayer(0.5F, 0.0F, 2.0F, i1);
    }
    while (true)
    {
      return;
      this.U.setShadowLayer(0.5F, 0.0F, 2.0F, i1);
      this.V.setShadowLayer(0.5F, 0.0F, 2.0F, i1);
      this.W.setShadowLayer(0.5F, 0.0F, 2.0F, i1);
    }
  }

  private void f()
  {
    if (this.q != null)
      setTitle(this.q.U());
    g(8);
  }

  private void g()
  {
    if (this.u == null)
    {
      this.u = new com.netease.pris.activity.a.v(this.w);
      this.u.a(this.r);
    }
    if (this.S != null)
      this.S.setAdapter(this.u);
    if (this.v == null)
    {
      this.v = new ak(this.w);
      this.v.a(this.s);
    }
    if (this.T != null)
      this.T.setAdapter(this.v);
  }

  private void h()
  {
    if (this.G != null)
      this.G.setOnClickListener(this.d);
    if (this.H != null)
      this.H.setOnClickListener(this.d);
    if (this.I != null)
      this.I.setOnClickListener(this.d);
    if (this.J != null)
      this.J.setOnClickListener(this.d);
    if (this.F != null)
      this.F.setOnTouchListener(this.e);
    if (this.K != null)
      this.K.setOnClickListener(this.d);
    if (this.L != null)
      this.L.setOnClickListener(this.d);
    if (this.N != null)
      this.N.setOnClickListener(this.d);
    if (this.T != null)
      this.T.setOnItemClickListener(this.X);
  }

  private void r()
  {
    u localu = this.q;
    if (localu == null)
      return;
    String str1 = localu.b(g.g);
    if (str1 == null)
      str1 = localu.b(g.f);
    if ((str1 != null) && (this.x != null))
    {
      StringBuilder localStringBuilder = new StringBuilder();
      this.x.setTag(localStringBuilder);
      com.netease.image.d.a().a(localStringBuilder, 0, str1, new ds(this), -1, -1, 2, this.o);
    }
    String str2 = localu.U();
    if ((str2 != null) && (this.y != null))
      this.y.setText(str2);
    if (this.E != null)
    {
      this.E.setNumStars(localu.ae());
      this.E.setRating((float)localu.ah());
    }
    int i1;
    if (this.A != null)
    {
      i1 = localu.am();
      if (i1 > 0)
      {
        label158: TextView localTextView = this.A;
        Object[] arrayOfObject = new Object[1];
        arrayOfObject[0] = Integer.valueOf(i1);
        localTextView.setText(getString(2131361966, arrayOfObject));
      }
    }
    else
    {
      if (this.B != null)
        this.B.setText(localu.ai());
      if (this.H != null)
      {
        if (!localu.ak())
          break label415;
        this.H.setVisibility(0);
        this.P.setVisibility(8);
        this.H.setText(2131361879);
        this.H.setCompoundDrawablesWithIntrinsicBounds(2130837548, 0, 0, 0);
      }
      label265: if (this.I != null)
      {
        if ((!localu.L()) || (!localu.ak()))
          break label486;
        this.I.setVisibility(0);
        this.I.setText(2131361959);
        this.I.setCompoundDrawablesWithIntrinsicBounds(2130837549, 0, 0, 0);
      }
    }
    while (true)
    {
      String str3 = localu.W();
      if ((str3 == null) || (str3.trim().length() == 0))
        str3 = this.w.getString(2131361967);
      if (this.C != null)
        this.C.setText(str3);
      localu.b(g.b);
      if (this.N == null)
        break;
      this.N.setChecked(com.netease.pris.c.c.c(this.w, com.netease.b.a.d.h().c(), localu.V()));
      break;
      i1 = 0;
      break label158;
      label415: if (localu.al())
      {
        this.H.setVisibility(0);
        this.P.setVisibility(8);
        this.H.setText(2131361909);
        this.H.setCompoundDrawablesWithIntrinsicBounds(2130837547, 0, 0, 0);
        break label265;
      }
      this.P.setVisibility(8);
      this.H.setVisibility(8);
      break label265;
      label486: this.I.setVisibility(8);
    }
  }

  private void s()
  {
    u localu = this.q;
    if (localu == null);
    while (true)
    {
      return;
      try
      {
        String str = localu.b(g.d);
        if (str == null)
          continue;
        this.l = true;
        b_();
        this.n = (1 + this.n);
        a(800, null, str, localu.V());
        continue;
      }
      catch (NullPointerException localNullPointerException)
      {
        localNullPointerException.printStackTrace();
        continue;
      }
      finally
      {
      }
    }
    throw localObject;
  }

  private void t()
  {
    u localu = this.q;
    try
    {
      if ((this.p != null) && (localu != null))
      {
        this.l = true;
        this.J.setEnabled(false);
        b_();
        this.n = (1 + this.n);
        a(804, null, this.p, localu.V());
      }
    }
    catch (NullPointerException localNullPointerException)
    {
      localNullPointerException.printStackTrace();
    }
    finally
    {
    }
  }

  private void u()
  {
    u localu = this.q;
    if (localu == null);
    while (true)
    {
      return;
      try
      {
        String str = localu.b(g.G);
        if (str == null)
          continue;
        b_();
        this.n = (1 + this.n);
        a(304, null, str, null);
        continue;
      }
      catch (NullPointerException localNullPointerException)
      {
        localNullPointerException.printStackTrace();
        continue;
      }
      finally
      {
      }
    }
    throw localObject;
  }

  private void v()
  {
    if (this.D != null)
    {
      this.D.setText("");
      this.D.requestFocus();
      this.M.showSoftInput(this.D, 0);
    }
    if (this.F != null)
      this.F.setRating(0.0F);
    if (this.O != null)
    {
      this.O.setVisibility(0);
      Animation localAnimation = a.e();
      this.O.startAnimation(localAnimation);
    }
  }

  private void w()
  {
    if (this.D != null)
    {
      this.D.setText("");
      IBinder localIBinder = this.D.getWindowToken();
      this.M.hideSoftInputFromWindow(localIBinder, 0);
    }
    if (this.O != null)
    {
      this.O.setVisibility(8);
      Animation localAnimation = a.g();
      this.O.startAnimation(localAnimation);
    }
  }

  private boolean x()
  {
    int i1 = 0;
    u localu = this.q;
    if (localu == null);
    String str;
    while (true)
    {
      return i1;
      if (!localu.L())
        continue;
      if ((this.F == null) || (0.0F == this.F.getRating()))
      {
        h.a(this.w, 2131361969);
        continue;
      }
      if (this.D == null)
        continue;
      str = this.D.getEditableText().toString();
      if (!TextUtils.isEmpty(str.trim()))
        break;
      h.a(this.w, 2131361970);
    }
    if (!TextUtils.isEmpty(localu.ac()))
    {
      a(801, localu.ac(), localu.V(), str);
      label119: if (TextUtils.isEmpty(localu.ad()))
        break label199;
      this.m = com.netease.pris.v.a().a(localu.ad(), localu.V(), "", (float)Math.ceil(this.F.getRating()));
      this.t.add(new Integer(this.m));
    }
    while (true)
    {
      i1 = 1;
      break;
      h.a(this.w, 2131361971);
      break label119;
      label199: h.a(this.w, 2131361972);
    }
  }

  public void a(View paramView)
  {
    if (!(paramView instanceof CheckBox));
    while (true)
    {
      return;
      if (this.q != null)
      {
        com.netease.pris.c.c.a(this.w, com.netease.b.a.d.h().c(), this.q.V(), ((CheckBox)paramView).isChecked());
        continue;
      }
    }
  }

  public void b()
  {
    g(0);
    this.z.setVisibility(8);
  }

  public void b_()
  {
    g(8);
    this.z.setVisibility(0);
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903101);
    this.w = this;
    this.o = com.netease.b.a.d.f();
    com.netease.pris.v.a().a(this.f);
    this.q = PrisApp.a().q();
    this.q = com.netease.pris.c.c.b(this.w, com.netease.b.a.d.h().c(), this.q);
    Intent localIntent = getIntent();
    if (localIntent != null)
      this.k = localIntent.getBooleanExtra("comment", false);
    this.t = new LinkedList();
    this.r = new LinkedList();
    this.s = new LinkedList();
    this.M = ((InputMethodManager)getSystemService("input_method"));
    e();
    g();
    h();
    r();
    s();
    u();
    f();
    if (this.k)
    {
      this.h = true;
      v();
    }
  }

  public Dialog onCreateDialog(int paramInt)
  {
    AlertDialog localAlertDialog = null;
    switch (paramInt)
    {
    default:
    case 2:
    }
    while (true)
    {
      return localAlertDialog;
      AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
      localBuilder.setIcon(2130837639);
      localBuilder.setTitle(2131361879);
      localBuilder.setMessage(2131361880);
      localBuilder.setPositiveButton(2131361881, new dk(this));
      localBuilder.setNegativeButton(2131361882, new dl(this));
      localAlertDialog = localBuilder.create();
    }
  }

  public void onDestroy()
  {
    super.onDestroy();
    com.netease.pris.v.a().b(this.f);
    com.netease.pris.v.a().a(this.o);
    if (this.t != null)
      this.t.clear();
    if (this.r != null)
      this.r.clear();
    if (this.s != null)
      this.s.clear();
    this.q = null;
    this.x = null;
    this.y = null;
    this.A = null;
    this.B = null;
    this.C = null;
    this.D = null;
    this.E = null;
    this.F = null;
    this.G = null;
    this.H = null;
    this.I = null;
    this.J = null;
    this.K = null;
    this.L = null;
    this.O = null;
    this.N = null;
    this.P = null;
    this.Q = null;
    this.S = null;
    this.T = null;
    this.d = null;
    this.e = null;
    this.w = null;
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    int i1 = 0;
    boolean bool = true;
    if (4 != paramInt)
      if (i1 == 0)
        break label91;
    while (true)
    {
      return bool;
      if (!this.h)
        break;
      if (this.D.getText().length() > 0)
      {
        c();
        i1 = bool;
        break;
      }
      w();
      this.h = false;
      if (!this.k)
      {
        i1 = bool;
        break;
      }
      com.netease.pris.d.c.a(p(), 1601, this.q.U());
      break;
      label91: bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  public void onPause()
  {
    super.onPause();
  }

  public void onPrepareDialog(int paramInt, Dialog paramDialog)
  {
    switch (paramInt)
    {
    case 2:
    }
  }

  public void onResume()
  {
    super.onResume();
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.SubsInfoActivity
 * JD-Core Version:    0.6.0
 */